<?php

namespace common\models\wechat;

use Yii;

/**
 * This is the model class for table "wechat_pay_setting".
 *
 * @property string $id
 * @property integer $wid
 * @property string $payaccount
 * @property string $mchid
 * @property string $apisecret
 * @property integer $status
 */
class WechatPaySetting extends \yii\db\ActiveRecord
{

    //主要用于日志记录
    public $uselog = [
        'tabcomment' => '微信支付参数',      //用于修改了什么的显示
        'mainfield' => 'mchid',      //主要的显示标题的字段
        'picturefield' => [],        //图片字段
        'timefield' => [],       //时间字段
        'unsetfiled' =>[],      //不需要记录的字段
    ];

    /**
     * 未激活状态
     */
    const STATUS_INACTIVE = 0;
    /**
     * 激活状态
     */
    const STATUS_ACTIVE = 1;

    public static $statuses = [
        self::STATUS_INACTIVE => '未激活状态',
        self::STATUS_ACTIVE => '激活状态'
    ];

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'wechat_pay_setting';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['wid', 'payaccount', 'mchid', 'apisecret', 'status'], 'required'],
            [['wid', 'status'], 'integer'],
            [['payaccount', 'mchid', 'apisecret'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'payaccount' => '支付账号',
            'mchid' => '微信支付商户号(MchId)',
            'apisecret' => '商户支付密钥(API密钥)',
            'status' => '状态',
        ];
    }
}
